ID = 0  # 账号
name = ""  # 姓名
password = 0  # 密码
balance = 0  # 余额
bank = ""  # 银行
site = ""#地址
account={1:[1,'1','1',1,1,1],10000000:['张三','123456','定位在地球',100000000,'工商银行'],12345678:['张三','123456','定位在地球',100000000,'工商银行']}
dec=0#判断

def isDigit(a):
    a=a
    if a.isdigit():
        a=int(a)
        return a
    else:
        b=input("请输入数字")
        return isdigit(b)
def log():#登录
    print("*********************")
    print("*       工商银行      *")
    print("*      账户管理系统    *")
    print("*       v1.0        *")
    print("*********************")
    print("       1.开户         ")
    print("       2.存钱         ")
    print("       3.取钱         ")
    print("       4.转账         ")
    print("       5.查询         ")
    print("       6.bye         ")
    print("*********************")
def log_in():#登录
    id_1=input("请输入你的id")
    password_1=input("请输入你的密码")
    if id_1.isdigit():
        id_1=int(id_1)
        dec = id_1 in account
    else:
        dec=False
    if dec:
        if account[id_1][1]==password_1:
            print("登陆成功")
            return id_1
        else:
            print("登录失败，密码错误")
            return False
    else:
        print("登录失败账号不存在")
        return False
def login():#注册
    dec= len(account)
    if dec>100:
        print("用户已满100无法继续添加")
        return 3
    Id=input("请输入你要注册的id")
    Id=int(Id)
    if Id>99999999 or Id<10000000:
        print("输入id有误请重新输入")
        return login()
    dec=Id in account
    if dec==True:
        print("该id以注册请重新输入")
        return 2
    else:
        name=input("请输入你的姓名")
        password =input("请输入你的密码")
        balance =input("请输入你的余额")
        balance=isDigit(balance)
        bank = '工商银行'
        site = input("请输入你的地址")

        account[Id]={name,password,balance,bank,site}
        print("注册成功")
        return 1

def save():#存钱
    id_1=log_in()
    while 1:
        if id_1:
            save_1=input("请输入存款金额")
            if save_1.isdigit():
                save_1=int(save_1)
                account[id_1][3]=save_1
                print("存款成功")
                return
        else:
            dec = input("是否继续登录？是/否（其他内容视为否）")
            if dec=="是":
                return save()
            else:
                return False
def draw():#取钱
    id_1 = log_in()
    while 1:
        if id_1:
            draw_1 = input("请输入取款金额")
            if draw_1.isdigit():
                draw_1 = int(draw_1)
                if draw_1<=account[id_1][3]:
                    account[id_1][3] = draw_1
                    print("取款成功")
                    return
                else:
                    print("余额不足，请重新输入")
        else:
            dec = input("是否继续登录？是/否（其他内容视为否）")
            if dec == "是":
                return draw()
            else:
                return False
def transfer ():#转账
    id_1 = log_in()
    while 1 :
        if id_1:
            id_2=input("请输入转入账号")
            if id_2.isdigit():
                id_2 = int(id_2)
                dec = id_2 in account
            else:
                dec = False
            while 1 :
                if dec:
                    balance_1=input("请输入转入金额")
                    if balance_1.isdigit():
                        balance_1=int(balance_1)
                        if account[id_1][3]>=balance_1:
                            account[id_1][3]=account[id_1][3]-balance_1
                            account[id_2][3]=account[id_2][3]+balance_1
                            print("转账成功")
                            break
                        else:
                            print("转账失败，转账金额超出余额")
                    else:
                        print("转账失败，转账金额输入错误")
                else:
                    dec = input("是否继续输入？是/否（其他内容视为否）")
                    if dec == "是":
                        break
                    else:
                        return
        else:
            dec = input("是否继续登录？是/否（其他内容视为否）")
            if dec == "是":
                transfer()
            else:
                return False


def refer():#查询
    id_1 = log_in()
    if id_1:
        for i in account[id_1]:
            print(i)
def decide():#判断
    a=input("请输入选择")
    return a
while True:
    log()
    dec=decide()
    if dec=='1':
        login()
    elif dec=='2':
        save()
    elif dec=='3':
        draw()
    elif dec=='4':
        transfer()
    elif dec=="5":
        refer()
    elif dec=="6":
        break
    else:
        print("输入错误请重新输入")

